import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.util.ArrayList;

public class FuCore {
	private ArrayList<String> finale;
	public FuCore(ArrayList<String> list) {
		finale = new ArrayList<String>(list.size());
		for(int i = 0;i < list.size();i++) {
			ScriptEngineManager mgr = new ScriptEngineManager();
			try {
				ScriptEngine eng = mgr.getEngineByName("JavaScript");
				//System.out.println(list.get(i));
				Object obj = eng.eval(list.get(i));
				finale.add(obj.toString());
			}
			catch (ScriptException E) {
				System.out.println(E.toString());
			}
		}
	}
	public ArrayList<String> Get() {
		return finale;
	}
	public static String Eval(String expr) {
		String ret = new String();
		ScriptEngineManager mgr = new ScriptEngineManager();
		try {
			ScriptEngine eng = mgr.getEngineByName("JavaScript");
			ret = eng.eval(expr).toString();
		}
		catch (ScriptException E) {
			System.out.printf("Invalid Expression .");
		}
		return ret;
	}
}

